package com.miao.config;


import com.miao.UserClass.MyCondition1;
import com.miao.UserClass.MyCondition2;
import com.miao.UserClass.MyImportSelector;
import com.miao.UserClass.MyTypeFilter;
import com.miao.entity.Boy;
import com.miao.entity.Cat;
import com.miao.entity.Color;
import org.springframework.context.annotation.*;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.stereotype.Controller;


@Configuration
@ComponentScan(value="com.miao.ForScan", excludeFilters = {
        @Filter(type = FilterType.ANNOTATION, classes = {Controller.class}),
        @Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
})
@Import( {Cat.class, Color.class, MyImportSelector.class})
public class JavaConfig3 {


    @Conditional(MyCondition1.class)
    @Bean("boy1")
    Boy boy1(){
        return new Boy("ZhangSan", 10);
    }


    @Conditional(MyCondition2.class)
    @Bean("boy2")
    Boy boy2(){
        return new Boy("LiSi", 20);
    }




}
